package cn.edu.zafu.bigdata.x.hjn;

// TestPolymorphism.java
public class TestPolymorphism {
    public static void main(String[] args) {
        // 创建一个 Vehicle 数组
        Vehicle[] vehicles = new Vehicle[2];

        // 初始化数组，存储 Car 和 Bicycle 对象
        vehicles[0] = new Car();
        vehicles[1] = new Bicycle();

        // 调用各自的 move() 方法
        for (Vehicle vehicle : vehicles) {
            vehicle.move();
        }
    }
}
